<?php
/**
 * index.phtml
 * 
 * this one uses recursion... Which, imho, is a bit of an evil technique for view scripts
 * it really sacrifices simplicity. I couldn't think of a better way of doing this though.
 * I'm sorry. But this might be a good chance for those of you who don't have a degree in
 * computer science to... Learn! Knowledge is power!
 * 
 * @category    Madoqua
 * @package     Module
 * @subpackage  Blog
 */

/**
 * simple recursive function that will print an unordered list (<ul>) for every category,
 * nested per parent.
 *
 * @param array $list
 */
function category($list) {
    echo '<ul class="categories">';
    
    foreach($list as $category) {
        echo '<li>' . $category['name'];
        if (isset($category['children'])) {
            
            category($category['children']);
        } else {
            
        }
        echo '</li>';
    }
    
    echo '</ul>';
}

category($this->categories);
//start the recursion!

?>
